import 'package:flutter/material.dart';
import 'package:rembercount/pages/homepage.dart';
import 'package:rembercount/pages/record_page.dart';

class TabPage extends StatefulWidget {
  const TabPage({super.key});

  @override
  State<TabPage> createState() => _TabPageState();
}

class _TabPageState extends State<TabPage> with TickerProviderStateMixin {
  var themColor = Colors.green;
  var currentIndex = 0;
  final List<BottomNavigationBarItem> items = [
    const BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页'),
    const BottomNavigationBarItem(icon: Icon(Icons.add_circle_outline), label: '记一笔'),
    const BottomNavigationBarItem(icon: Icon(Icons.notifications), label: '统计'),
    const BottomNavigationBarItem(icon: Icon(Icons.person), label: '我的'),
  ];
  List<Widget> tabWidget=[Homepage(),RecordPage()];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text(
            'Financials',
            style: TextStyle(fontWeight: FontWeight.bold),
          ),
          centerTitle: true,
           actions: [
          IconButton(
            icon: const Icon(Icons.calendar_month_outlined),
            onPressed: null,
          )
        ],
        ),
        body: tabWidget[currentIndex],
        bottomNavigationBar: BottomNavigationBar(
          items: items,
          currentIndex: 0,
          onTap: (index) {
            setState(() {
              currentIndex = index;
            });
          },
          selectedItemColor: const Color.fromARGB(76, 0, 0, 0),
          unselectedItemColor: themColor,
          showUnselectedLabels: true,
          showSelectedLabels: true,
          iconSize: 30,
          selectedFontSize: 16,
          unselectedFontSize: 14,
          type: BottomNavigationBarType.fixed,
        ),
      );
  }
}
